<template>
  <!-- 保持模板部分不变 -->
  <div class="feedback-view">
    <h2>用户反馈</h2>
    <form @submit.prevent="handleSubmit">
      <div class="form-group">
        <label>反馈类型：</label>
        <select v-model="formData.type" required>
          <option value="suggestion">功能建议</option>
          <option value="bug">错误报告</option>
          <option value="illegal">违法信息</option>
          <option value="spam">垃圾信息</option>
          <option value="inappropriate">不当内容</option>
          <option value="other">其他内容</option>
        </select>
      </div>
      <div class="form-group">
        <label>反馈内容：</label>
        <textarea 
          v-model="formData.content" 
          placeholder="请详细描述您的反馈内容"
          required
        ></textarea>
      </div>
      <button type="submit" class="submit-btn">提交反馈</button>
    </form>
  </div>
</template>

<script setup>
import request from '@/utils/request'
import { reactive } from 'vue'
const user_id = localStorage.getItem('id')
// 响应式数据
const formData = reactive({
  type: 'suggestion',
  content: '',
  userId:user_id
})

// 提交方法
const handleSubmit = async() => {
  const res = await request.post('/feedback', formData)
  if (res.data.code === '200') {
    console.log('提交反馈：', formData)
    alert('反馈已提交，感谢您的建议！')
    formData.content = ''
  }else{
    alert(res.data.msg)
  }

}
</script>

<!-- 保持样式部分不变 -->
<style scoped>
.feedback-view {
  max-width: 800px;
  margin: 20px auto;
  padding: 20px;
}
.form-group {
  margin-bottom: 20px;
}
select, textarea {
  width: 100%;
  padding: 8px;
  margin-top: 5px;
}
textarea {
  height: 150px;
}
.submit-btn {
  background: #409eff;
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
</style>